package com.stylefeng.guns.core.common.exception;

import com.stylefeng.guns.core.exception.ServiceExceptionEnum;

/**
 * @author fengshuonan
 * @Description 所有业务异常的枚举
 * @date 2016年11月12日 下午5:04:51
 */
public enum BizExceptionEnum implements ServiceExceptionEnum {

    /**
     * 字典
     */
    DICT_EXISTED(400, "字典已经存在"),
    ERROR_CREATE_DICT(500, "创建字典失败"),
    ERROR_WRAPPER_FIELD(500, "包装字典属性失败"),
    ERROR_CODE_EMPTY(500, "字典类型不能为空"),

    /**
     * 文件上传
     */
    FILE_READING_ERROR(400, "FILE_READING_ERROR!"),
    FILE_NOT_FOUND(400, "FILE_NOT_FOUND!"),
    UPLOAD_ERROR(500, "上传图片出错"),

    /**
     * 权限和数据问题
     */
    DB_RESOURCE_NULL(400, "数据库中没有该资源"),
    NO_PERMITION(405, "权限异常"),
    REQUEST_INVALIDATE(400, "请求数据格式不正确"),
    INVALID_KAPTCHA(400, "验证码不正确"),
    CANT_DELETE_ADMIN(600, "不能删除超级管理员"),
    CANT_FREEZE_ADMIN(600, "不能冻结超级管理员"),
    CANT_CHANGE_ADMIN(600, "不能修改超级管理员角色"),

    /**
     * 账户问题
     */
    USER_ALREADY_REG(401, "该用户已经注册"),
    NO_THIS_USER(400, "没有此用户"),
    USER_NOT_EXISTED(400, "没有此用户"),
    ACCOUNT_FREEZED(401, "账号被冻结"),
    OLD_PWD_NOT_RIGHT(402, "原密码不正确"),
    TWO_PWD_NOT_MATCH(405, "两次输入密码不一致"),

    /**
     * 错误的请求
     */
    MENU_PCODE_COINCIDENCE(400, "菜单编号和副编号不能一致"),
    EXISTED_THE_MENU(400, "菜单编号重复，不能添加"),
    DICT_MUST_BE_NUMBER(400, "字典的值必须为数字"),
    REQUEST_NULL(400, "请求有错误"),
    SESSION_TIMEOUT(400, "会话超时"),
    SERVER_ERROR(500, "服务器异常"),

    /**
     * token异常
     */
    TOKEN_EXPIRED(700, "token过期"),
    TOKEN_ERROR(700, "token验证失败"),

    /**
     * 签名异常
     */
    SIGN_ERROR(700, "签名验证失败"),

    /**
     * 其他
     */
    AUTH_REQUEST_ERROR(400, "账号密码错误"),

    /**
     * VPN业务异常
     */
    VPN_APP_VERSION_ADD_ERROR(20001,"版本号输入错误"),

    VPN_SERVER_IP_SEGMENT_ERROR(20201,"网段格式错误"),
    VPN_ALLOW_IP_FAIL(20202,"网段IP异常"),
    VPN_SERVER_ICON_NOT_EXIST(20301,"图标不能为空"),
    VPN_SERVER_IS_EXIST(20401,"VPN服务器信息不存在"),

    VPN_PUSH_MSG_PARAM_ERROR(30001,"消息参数错误"),
    VPN_PUSH_MSG_NOT_EXIST(30002,"消息不存在，请重新选择"),
    VPN_PUSH_MSG_FAIL(30003,"消息推送失败"),
    VPN_PUSH_MSG_TITLE_SIZE_TOO_LONG(30004,"标题字数不能超过30个字"),
    VPN_PUSH_MSG_CONTENT_SIZE_TOO_LONG(30005,"推送内容不能超过100个字"),
    VPN_PUSH_MSG_LINK_ERROR(30006,"跳转H5网页地址格式不合法"),


    VPN_UPLOAD_FILE_ERROR(50003,"文件上传错误"),
    VPN_UPLOAD_FILE_FAIL(50004,"文件上传失败"),

    VPN_RESET_PWD_NOT_EXIST(50101,"用户不存在"),
    VPN_RESET_PWD_FORMAT_ERROR(50102,"密码格式错误"),

    VPN_OFFLINE_VPN_ERROR(50201,"断连VPN服务出错"),
    VPN_DIS_CONNECT_FAIL(50202,"定时断开连接失败"),

    VPN_API_REDIS_NOT_TOKEN(50301,"服务项缺失，请联系管理员"),
    VPN_ADD_VIP_PACKAGE_FAIL(50302,""),


    VPN_GEOIP_PATH_NOT_EXIST(60101,"GEO IP Database not Exist"),

    VPN_CHANNEL_NAME_ERROR(70001,"渠道名称不能为空"),
    VPN_CHANNEL_INSERT_ERROR(70002,"渠道添加错误"),
    VPN_CHANNEL_NOT_EXIST(70003,"渠道不存在"),
    VPN_CHANNEL_IN_CONDITION_NULL(70004,"查询渠道不能为空"),


    EXCLUSIVE_PACKAGE_NOT_EXIST(80001,"删除信息不存在"),
    EXCLUSIVE_SERVER_NOT_EXIST(80002,"请先添加专属服务器"),
    EXCLUSIVE_PARAMS_ERROR(80003,"请检查参数是否正确"),


    VPN_ADS_UPDATE_DATE_ERROR(90001,"请重新修改生效有效时间"),
    VPN_ADS_UPDATE_NOT_EXIST(90002,"该广告信息不存在"),
    VPN_ADS_UPDATE_URL_ERROR(90003,"广告跳转地址格式错误"),

    VPN_PACKAGE_DISCOUNT_PACKAGE_NOT_EXIST(90601,"该套餐不存在"),
    VPN_PACKAGE_DISCOUNT_ERROR(90602,"同一套餐，相同时间段内只能有一个折扣"),
    VPN_PACKAGE_DISCOUNT_EXIST(90603,"该套餐已存在折扣，请直接进行修改"),
    VPN_PACKAGE_DISCOUNT_HINT_ERROR(90604,"折扣文案不能为空"),
    VPN_PACKAGE_DISCOUNT_PARAM_ERROR(90605,"折扣为0-1之间小数"),
    VPN_PACKAGE_DISCOUNT_TIME_ERROR(90606,"折扣时间格式错误"),
    VPN_PACKAGE_SHOW_SORT_ERROR(90607,"套餐展示顺序不能为空"),
    VPN_PACKAGE_SHOW_SORT_EXIST(90608,"套餐展示顺序已存在")

    ;


    BizExceptionEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    private Integer code;

    private String message;

    @Override
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
